#ifndef _SSAORENDERPASS_H_
#define _SSAORENDERPASS_H_
#include <SERender/Renderer/RenderPass/RenderPass.h>
#include <SERender/Resourses/FrameBuffer.h>
#include <SERender/Resourses/Texture.h>
#include <SERender/Resourses/Material.h>
#include <memory>
#include <vector>

namespace SEngine
{
    class SSAORenderPass : public RenderPass
    {
    public:
        SSAORenderPass(Renderer & renderer);
        virtual ~SSAORenderPass() = default;
        virtual void BeginFrame() override;
        virtual void DrawFrame() override;
        virtual void EndFrame() override {}
    private:
        std::vector<glm::vec3> RandomKernel(size_t num);
        std::shared_ptr<Texture2D> CreateNoiseMap(int size);
    private:
        ResRef<Material>             m_BlurMaterial;
        ResRef<Material>             m_SSAOMaterial;
        ResRef<Material>             m_RTMaterial;
        std::shared_ptr<Texture2D>      m_positionRT;
        std::shared_ptr<Texture2D>      m_normalRT;
        std::shared_ptr<Texture2D>      m_tangentRT;
        std::shared_ptr<Texture2D>      m_SSAOTex;
        std::shared_ptr<Texture2D>      m_SSAONoise;
        std::unique_ptr<FrameBuffer>  m_fbo;
        std::vector<glm::vec3>        m_SSAOSamples;
        
    };
} // namespace SEngine


#endif